package com.baizhi.serviceplus.impl;

import com.baizhi.entity.Admin;
import com.baizhi.service.AdminService;
import com.baizhi.serviceplus.AdminServicePlus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
@Service
public class AdminServicePlusImpl implements AdminServicePlus {
    @Autowired
    private AdminService adminService;

    @Override
    public Map updateAdmin(Admin admin) {
        Map map=new HashMap();
        try {
            adminService.updateAdmin(admin);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;
    }

    @Override
    public Map insertAdmin(Admin admin) {
        Map map=new HashMap();
        try {
            adminService.insertAdmin(admin);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;
    }

    @Override
    public Map deleteAdmin(Integer id) {
        Map map=new HashMap();
        try {
            adminService.deleteAdmin(id);
            map.put("isOk",true);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("isOk",false);
        }
        return map;
    }
}
